const mongoose = require('mongoose')
mongoose.connect('mongodb://localhost/foods', { useNewUrlParser: true, useUnifiedTopology: true })
    //连接数据库
var db = mongoose.connection //数据库的链接对象
db.on('erro', console.error.bind(console, 'connection error:'));
db.once('open', function() {
    console.log('db ok')
})